package com.googlecode.cswish.struts.conversion;

import org.apache.struts2.components.Password;

import com.googlecode.cswish.model.PageElement;
import com.googlecode.cswish.model.PropertyInfo;

/**
 * Convert password object
 * 	 
 * @author jerry.feng Date: 2009-1-13
 */
public class PasswordElementConverter extends CommonElementConverter {

	@Override
	public PageElement convert(ConversionContext context) {
		PropertyInfo propertyInfo = context.getPropertyInfo();
		String name = propertyInfo.getName(); 
		if (name.startsWith("password")) {
			PageElement element = super.convert(context);
			
			String type = Password.class.getName();
			element.setType(type);
			return element;
		}
		return null;
	}
}
